
#include "gui/objects/GUIMap.h"

namespace gui {

GUIMap::GUIMap(Map* map) {
	this->map = map;
}

GUIMap::~GUIMap() {

}

int GUIMap::getTotalHeight() {
	return gui::toPixels(this->map->getFartherSouth() - this->map->getFartherNorth()) + 2 * CHANGUI_IN_PIXELS;
}

int GUIMap::getTotalWidth() {
	return gui::toPixels(this->map->getFartherEast() - this->map->getFartherWest()) + 2 * CHANGUI_IN_PIXELS;
}


int GUIMap::getTopLimit() {
	return gui::toPixels(this->map->getFartherNorth()) - CHANGUI_IN_PIXELS;
}

int GUIMap::getLeftLimit() {
	return gui::toPixels(this->map->getFartherWest()) - CHANGUI_IN_PIXELS;
}

void GUIMap::addGUIBaseSegment(RoadSegment* roadSegment) {
	GUIObject* obj = this->factory->createGUIBaseSegment(roadSegment);
	this->guiObjects.append(obj);
}
void GUIMap::addGUIIntersection(Intersection* intersection, RoadType type) {
	GUIObject* obj = this->factory->createGUIIntersection(intersection, type);
	this->guiObjects.append(obj);
}
void GUIMap::addGUIRoadSegment(RoadSegment* roadSegment) {
	GUIObject* obj = this->factory->createGUIRoadSegment(roadSegment);
	this->guiObjects.append(obj);
}
void GUIMap::addGUIRoadArrow(RoadSegment* roadSegment) {
	GUIObject* obj = this->factory->createGUIRoadArrow(roadSegment);
	this->guiObjects.append(obj);
}
void GUIMap::addGUIRoadArrow(RoadSegment* roadSegment, bool inverted) {
	GUIObject* obj = this->factory->createGUIRoadArrow(roadSegment);
	if (inverted) {
		obj->setRotation(obj->getRotation() + PI);
	}
	this->guiObjects.append(obj);
}
void GUIMap::addGUIMapLocation(MapLocation* mapLocation) {
	GUIObject* obj = this->factory->createGUIMapLocation(mapLocation);
	this->guiObjects.append(obj);
}

}
